class ApiError extends Error {
  constructor(statusCode, message) {
    super(message); //获取父类message
    this.statusCode = statusCode;
    this.isOperational = true; // 标记这是一个操作性错误
  }
  static notFound(message = "Document not found") {
    return new ApiError(404, message);
  }

  static internal(message = "Internal Server Error") {
    return new ApiError(500, message);
  }
}
